package com.demo.employee;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "STUDENT_MASTER"/*,uniqueConstraints=@UniqueConstraint(columnNames={"id","MOBILE"}*/)
public class StudentDTO {

	private int id;
	private String name;
	private int age;
	private String course;
	private String mobileNo;
	
	public void setMobileNo(String mobileNo) {
		this.mobileNo = mobileNo;
	}

    private Address homeAddress; //composite type value 
	
	private Address residencialAddress;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getId() {
		return id;
	}
	
	@Column(name="MOBILE")
	public String getMobileNo() {
		return mobileNo;
	}
	
	
	@Column(name="STUDENT_NAME")
	public String getName() {
		return name;
	}

	@Column(name="STUDENT_AGE")
	public int getAge() {
		return age;
	}
    @Column(name="COURSE")
	public String getCourse() {
		return course;
	}

	@Embedded
    public Address getHomeAddress() {
		return homeAddress;
	}
    
    public void setHomeAddress(Address homeAddress) {
		this.homeAddress = homeAddress;
	}
    

	@Embedded
	@AttributeOverrides({@AttributeOverride(name="hNo",column=@Column(name="RES_H_NO")),
		@AttributeOverride(name="city",column=@Column(name="RES_CITY")),
		@AttributeOverride(name="street",column=@Column(name="RES_STREET")),
		@AttributeOverride(name="country",column=@Column(name="RES_COUNTRY"))
	 })
    public Address getResidencialAddress() {
		return residencialAddress;
	}
    public void setResidencialAddress(Address residencialAddress) {
		this.residencialAddress = residencialAddress;
	}
    
	public void setId(int id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public void setCourse(String course) {
		this.course = course;
	}

	@Override
	public String toString() {
		return "StudentDTO [id=" + id + ", name=" + name + ", age=" + age
				+ ", course=" + course + "]";
	}

}
